package hv.fmw.core.configure {
	import hv.fmw.core.command.Command;
	import hv.fmw.core.command.ICommand;
	import hv.fmw.utils.Config;
	import hv.lib.text.Text;

	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.text.StyleSheet;
	/**
	 * @author hvong
	 */
	public class ConfigureCSSCmd extends Command implements ICommand {
		
		public function ConfigureCSSCmd() {
			
		}
		
		public function execute() : void {
			var loader:URLLoader = new URLLoader();
				loader.addEventListener(Event.COMPLETE, _onCommandComplete);
				loader.load(new URLRequest(Config.getPath("stylesheet")));
		}

		private function _onCommandComplete(event : Event) : void {
			var css:StyleSheet = new StyleSheet();
				css.parseCSS(event.target.data);
			Text.css = css;
			super.complete();
		}
	}
}
